﻿
namespace Marmat.Forms
{
    public partial class EditControl
    {

        /// <summary>
        /// 将 CaptionTextAlign 属性重置为其默认值。
        /// </summary>
        protected internal void ResetCaptionTextAlign()
        {
            this.CaptionTextAlign = default;
        }

        /// <summary>
        /// 是否应该序列化 CaptionTextAlign 属性。
        /// </summary>
        /// <returns></returns>
        protected internal bool ShouldSerializeCaptionTextAlign()
        {
            return this._CaptionTextAlign != default;
        }

        /// <summary>
        /// 将 BindingField 属性重置为其默认值。
        /// </summary>
        protected internal void ResetBindingField()
        {
            this.BindingField.DataSource = null;
            this.BindingField.DataMember = null;
        }

        /// <summary>
        /// 是否应该序列化 BindingField 属性。
        /// </summary>
        /// <returns></returns>
        protected internal bool ShouldSerializeBindingField()
        {
            return !(this.BindingField.DataSource is null && string.IsNullOrEmpty(this.BindingField.DataMember));
        }

        /// <summary>
        /// 将 CaptionForeColor 属性重置为其默认值。
        /// </summary>
        protected internal void ResetCaptionForeColor()
        {
            this.CaptionForeColor = default;
        }

        /// <summary>
        /// 是否应该序列化 CaptionForeColor 属性。
        /// </summary>
        /// <returns></returns>
        protected internal bool ShouldSerializeCaptionForeColor()
        {
            return this._CaptionForeColor != default;
        }

        /// <summary>
        /// 将 CaptionForeColor 属性重置为其默认值。
        /// </summary>
        protected internal void ResetCaptionFont()
        {
            this.CaptionFont = null;
        }

        /// <summary>
        /// 是否应该序列化 CaptionForeColor 属性。
        /// </summary>
        /// <returns></returns>
        protected internal bool ShouldSerializeCaptionFont()
        {
            return this._CaptionFont != null;
        }
    }
}